function base_figs
close all
addpath ../

p = params;

set(0, 'defaulttextinterpreter','latex');
set(0,'defaulttextfontsize',14);



%----------------------------------------
% delta = 0.01
p.delta = 0.01;

s2 = base(p);

v2 = s2.y(1:end-1,:);
h2 = s2.y(end,:);
t2 = s2.x;

t2_asy = logspace(log10(t2(2)), log10(t2(end)), 30);
h2_asy = -(1 + lambertw(-p.beta / (p.beta - 1) * exp(((-p.beta + p.delta * t2_asy) / (p.beta - 1))))) * (p.beta - 1);

v2_long = (1 - p.beta) * (1 - 1 ./ h2_asy);
v2_short = sep_var(0, p);

%--------------------------------------------
% now plot the stuff

figure
semilogx(t2, h2, 'k','linewidth',1);
hold on;
semilogx(t2_asy, h2_asy, 'k*');
xlabel('$t$','fontsize',14);
ylabel('$h(t)$','fontsize',14);
l = legend ('$\delta = 0.01$ numerical', '$\delta = 0.01$ asymptotic', ...
    'location','southwest');
set(l, 'interpreter','latex','fontsize',14);
xlim([1e-5, p.Tmax]);
ylim([1 - p.beta, 1]);

figure
tmp = interp1(t2, abs(v2_short(p.N, :)), t2_asy);
loglog(t2, abs(v2(p.N,:)), 'k','linewidth',1);
hold on;
loglog(t2_asy, tmp, 'k*', t2_asy, abs(v2_long), 'ko');
ylim([1e-5, 1e1]);
set(gca, 'ytick',[1e-5, 1e-3, 1e-1, 1e1]);
xlabel('$t$','fontsize',14);
ylabel('$|c(h(t),t) - c_0|$', 'fontsize',14);
l = legend('numerical','$t = O(1)$ asymptotic','$t = O(\delta^{-1})$ asymptotic');
set(l,'interpreter','latex','fontsize',12,'location','southeast');
xlim([1e-5, p.Tmax]);


%------------------------
% BL stuff
% figure;

axes('Position',[0.176785714285713 0.538095238095239 0.363928571428567 0.322619047619057]);

eta = linspace(0, 1, p.N)';
t = logspace(-6, -1, 10);

tmp = interp2(eta, t2, v2', eta, t);

plot(eta, tmp(1,:), 'k', 'linewidth',1);
hold on;
for i = 2:length(t)
    plot(eta, tmp(i,:), 'k', 'linewidth',1,'HandleVisibility','off');
end

eta = linspace(0, 1, 25)';
tmp = interp2(linspace(0, 1, p.N)', t2, v2_short', eta, t);

plot(eta, tmp, 'k*');
ylim([-0.0008, 0]);

% l = legend('numerical','asymptotic','location','southwest');
% set(l, 'interpreter','latex','fontsize',11);

xlabel('$z / h(t)$');
% ylabel('$c$');